package com.situ.mybatis.test;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import com.situ.mybatis.entity.Student;
import com.situ.mybatis.mapper.IStudentDao;
import com.situ.mybatis.util.MyBatisUtil;

public class MyBatisTest2 {

	@Test
	public void test222() {
		SqlSession SqlSession = MyBatisUtil.getSqlSession();
		IStudentDao studentDao = SqlSession.getMapper(IStudentDao.class);
		Student student = new Student();
		student.setName("pdd");
		List<Student> list = studentDao.search(student);
		for (Student student2 : list) {
			System.out.println(student2);
		}
	}
	@Test
	public void test2() {
		SqlSession sqlSession = MyBatisUtil.getSqlSession();
		IStudentDao studentDao = sqlSession.getMapper(IStudentDao.class);
		Student student = new Student();
		student.setId(32);
		//student.setName("superadmin111");
		student.setAge(99);
		int count = studentDao.update(student);
		sqlSession.commit();
		System.out.println(count);
	}
}
